#ifndef TRI_3DWORLD_H_
#define TRI_3DWORLD_H_


#include <fstream>
#include <iostream>
#include <vector>

#include "glyph.h"
#include "base/xmlnode.h"
#include "base/logging.h"
#include "shapes.h"
#include "model3d.h"
#include "graphics.h"
#include "tile.h"

namespace tri{

class TWorld :public tri::TEntity{
public:
	TWorld();
	
	virtual ~TWorld();
	virtual void display();
		
	void loadTiles(std::string xmlfile);
	void loadMap(std::string file);
	
	void clear();
	void clearMap();
	void clearTileCache();
	
//	void getTiles
	
private:
//	void setData(tri::TEntity* ent, tri::TVector pos,TileObject* tile);
//	void addGlyph(tri::TVector pos,TileObject* tile);
//	void addModel(tri::TVector pos,TileObject* tile);
//	void addCube(tri::TVector pos,TileObject* tile);
//	void addBlank(tri::TVector pos,TileObject* tile);
	void addTile(TVector pos, TilePlane* tile, tri::TEntity* object = NULL);
	tri::TVector loadVector(tri::TXMLNode* node);
	
	TileTemplateCache mTileCache;
	std::vector<TilePlane*> mTiles;
	
};

}

#endif